//
//  MIDIactivityWebView.m
//  迷笛
//
//  Created by . on 2018/12/8.
//  Copyright © 2018年 🍃🌺🌺🍃. All rights reserved.
//

#import "MIDIactivityWebView.h"

@interface MIDIactivityWebView ()<UIWebViewDelegate>
@property(nonatomic,strong)UIWebView * webview;
@property(nonatomic,copy)NSString * webviewapi;
@end

@implementation MIDIactivityWebView

- (void)viewDidLoad {
    [super viewDidLoad];

    
    UIBarButtonItem *leftBarItem = [[UIBarButtonItem alloc] initWithTitle:nil style:UIBarButtonItemStylePlain target:self action:@selector(Block:)];
    self.navigationItem.leftBarButtonItem = leftBarItem;
    
    [self.navigationItem.leftBarButtonItem setImage:[[UIImage imageNamed:@"后退"] imageWithRenderingMode:UIImageRenderingModeAlwaysOriginal]];
    
    
    self.webview = [[UIWebView alloc]initWithFrame:CGRectMake(0, 0, self.view.frame.size.width, self.view.frame.size.height)];
    self.webview.delegate = self;
    [self.view addSubview:self.webview];
    //需要加载的网页
    self.webviewapi= [NSString stringWithFormat:@"%@activity/%@",MIDIApiRoot,self.ID];

    NSURL *url = [NSURL URLWithString:self.webviewapi];


    self.webview.opaque = false;
    self.webview.scrollView.scrollEnabled = YES;
    [self.webview loadRequest:[NSURLRequest requestWithURL:url]];
}
//视图将要出现时（导航颜色字体颜色）
- (void)viewWillAppear:(BOOL)animated
{
    self.tabBarController.tabBar.hidden = NO;
    self.navigationController.navigationBar.translucent = NO;//Bar的模糊效果，默认为YES
    self.title = self.name;

    self.navigationController.navigationBar.barTintColor = [UIColor colorWithHexString:@"#171717"];
    [self.navigationController.navigationBar setTitleTextAttributes:@{NSForegroundColorAttributeName:[UIColor colorWithHexString:@"#FFFFFF"],NSFontAttributeName : [UIFont fontWithName:@"Helvetica-Bold" size:WidthScale(17)]}];
    //    去掉导航黑线
    UIImage *img = [UIImage imageNamed:@""];
    [self.navigationController.navigationBar setBackgroundImage:img  forBarMetrics:UIBarMetricsDefault];
    self.navigationController.navigationBar.shadowImage = [[UIImage alloc] init];
}
// 返回上一级
-(void)Block:(UIButton * )sender
{
    [self.navigationController popViewControllerAnimated:YES];
}
@end
